
<!-- 设备减碳编辑业务实现-->
<template>
  <!-- 新增&修改 start-->
  <vxe-modal :modelValue="isEditFormVisible" :show-footer="true" :position="dialogPosition" :title="title" :width="dialogWidth" :height="dilogHeight" resize="" :before-hide-method="beforeCloseDialog">
    <el-form inline-message status-icon ref="dataFormRef" :rules="verify" :model="formData" label-position="right" label-width="140px" require-asterisk-position="right">
      <el-form-item label="主键" prop="id" v-show="false">
        <el-input v-model="formData.id" :readonly="isReadOnly"/>
      </el-form-item>
      <el-form-item label="目录" prop="catalog">
        <el-input v-model="formData.catalog" :columnInfo="{columnName:'目录',readonly:isReadOnly}" />
      </el-form-item>
      <el-form-item label="简介" prop="profile">
        <el-input v-model="formData.profile" type="textarea" :readonly="isReadOnly"/>
      </el-form-item>
      <el-form-item label="厂区">
        <lxsh-common-comb v-model="formData.factoryCode" :requestUrl="requestContextPath.basedata + '/basedata/factory/getComboList'" :columnInfo="{columnName:'厂区',readonly:isReadOnly}"/>
      </el-form-item>
      <el-form-item label="启用时间" prop="startDate">
        <el-date-picker v-model="formData.startDate" value-format="YYYY-MM-DD 00:00:00" type="date" :columnInfo="{columnName:'启用时间',readonly:isReadOnly}"/>
      </el-form-item>
      <el-form-item label="节天然气或节柴油" prop="gasReduceCount">
        <el-input v-model="formData.gasReduceCount" :columnInfo="{columnName:'节天然气或节柴油',readonly:isReadOnly}" />
      </el-form-item>
      <el-form-item label="节电" prop="electricityReduceCount">
        <el-input v-model="formData.electricityReduceCount" :columnInfo="{columnName:'节电',readonly:isReadOnly}" />
      </el-form-item>
      <el-form-item label="每日减碳" prop="carbonCount">
        <el-input type="number" :controls="false" v-model.number="formData.carbonCount" :columnInfo="{columnName:'每日减碳',readonly:isReadOnly}" />
      </el-form-item>
    </el-form>
	<template #footer>
		<el-button @click="beforeCloseDialog()">取消</el-button>
		<el-button type="primary" @click="onSubmit(dataFormRef)">确定</el-button>
	</template>
  </vxe-modal>
  <!-- 新增&修改 end-->
</template>
<script lang="ts" setup>
  import { requestContextPath } from 'lxsh-cer-web-pc/src/constants'
  import { hooksForCommonForm } from 'hhlt-vue/src/components/Lxsh/Common/hooksForCommonForm'
  import { Ref, ref, toRefs } from "vue"
  import { FormInstance } from 'element-plus';
  import { ICerDeviceImpro, CerDeviceImpro } from 'lxsh-cer-web-pc/src/model/cer/cer/device-impro/cer-device-impro'
  import { IPageInfo } from 'hhlt-core/src/model/page/pageInfo';
  interface ICommonFormProps {
    //官方暂不支持import props暂定解决方案，等后期支持后删除，issue #4294
    pageInfo:IPageInfo<ICerDeviceImpro>;
	  functionDistinguish:string;
      isEditFormVisible:Boolean;
  }
  //获取props参数
  const props = defineProps<ICommonFormProps>()
  //获取form实例
  const dataFormRef:Ref<FormInstance | undefined> = ref<FormInstance>();
  //自定义事件[本编辑界面处理完成]
  const emits = defineEmits(['editProcessSuccess'])
  //hooks初始化
  const {commonData,title,dialogPosition,dilogHeight,isReadOnly,beforeCloseDialog,onSubmit} = hooksForCommonForm<CerDeviceImpro>(new CerDeviceImpro(),dataFormRef,props,emits)
  //返回vue界面需要使用到的data
  const { dialogWidth,formData,verify} = toRefs(commonData)
</script>
